package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import server.business.mapper.BloodBagRecycleMapper;
import server.business.pojo.BloodBagRecycle;
import server.business.service.BloodBagRecycleService;

import java.util.List;

/**
* @author Galaxy
* @description 针对表【blood_bag_recycle】的数据库操作Service实现
* @createDate 2022-11-08 12:46:23
*/
@Service("bloodBagRecycleService")
public class BloodBagRecycleServiceImpl extends ServiceImpl<BloodBagRecycleMapper, BloodBagRecycle>
    implements BloodBagRecycleService{
    /*
     * mybatisplus提供的查询或者更新的信息
     */
    @Autowired
    private BloodBagRecycleMapper bloodBagRecycleMapper;

    public boolean saveOrUpdateBagRecycle(BloodBagRecycle bloodBagRecycle){
        return saveOrUpdate(bloodBagRecycle);
    }

//    @Override
//    public void updateConditionBynumber(String Number, String state) {
//
//    }
//
    @Override
    public void setconditionbybloodbagnum(String blood_bag_number) {
        LambdaUpdateWrapper<BloodBagRecycle> lambdaUpdateWrapper =new LambdaUpdateWrapper();
        lambdaUpdateWrapper.eq(Strings.isNotBlank(blood_bag_number), BloodBagRecycle::getNumber, blood_bag_number);
        lambdaUpdateWrapper.set(BloodBagRecycle::getState,"03");
        bloodBagRecycleMapper.update(null,lambdaUpdateWrapper);
    }

    @Override
    public List<BloodBagRecycle> getAll() {
        return this.list();
    }
}




